<meta title="用户服务添加" width="600px"/>
<div class="p">
    <div class="m-b clearfix">
        <form class="form-inline pull-left" id="form" s="form,valid">
            <input autocomplete="off" type="text" class="form-control input-sm" s-valid-error="require()" placeholder="输入手机号查找用户"
                   style="width:200px;" name="phone"/>
            <button type="button" class="btn btn-default btn-sm"
                    s-click="$form.validate().done(function() {$userPanel.refresh()})">查询
            </button>
        </form>
    </div>
    <form id="userServiceSubscriptionForm" class="form-inline" s="form,valid" method="post" action="/api/userServiceSubscription">
        <div id="userPanel"
             s='datac,check'
             s-check-multiple="false"
             s-data-switch="'off-on'"
             s-data="S.get('/api/user/find-by-phone', $form.node.serialize())">
            <table class="table table-striped table-bordered table-middle">
                <tr>
                    <th style="width: 100px;">手机号：<input autocomplete="off" type="hidden" s-valid-error="require()" s s-data-filter="'user.id'" name="userId"
                                                         id="userId"/></th>
                    <td name="user.phone" s s-data-filter="'user.phone'" style="width: 150px;"></td>
                    <th style="width: 100px;">昵称：</th>
                    <td name="user.nickname" s s-data-filter="'user.nickname'"></td>
                </tr>
                <tr>
                    <th style="width: 100px;">选择服务：</th>
                    <td>
                        <select class="form-control input-sm" s="select"
                                s-build="S.get('/api/enum/valuesMap/core.enums.Service')"
                                name="service">
                        </select>
                    </td>
                    <th style="width: 100px;">服务时长</th>
                    <td>
                        <input autocomplete="off" type="text" value="1" min="1" class="form-control input-sm" s-valid-error="require(),number()" name="timeValue" />
                        <select class="form-control input-sm" s="select"
                                s-data="'YEAR'"
                                s-build="S.get('/api/enum/valuesMap/core.enums.TimeUnit')"
                                name="timeUnit">
                        </select>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>
<script type="text/javascript">

    S.meta.btns = [
        {
            name: '确定',
            style: 'btn btn-primary',
            click: function () {
                return $userServiceSubscriptionForm.submit().done(function () {
                    S.close(true)
                })
            }
        },
        {
            name: '关闭',
            style: 'btn btn-default',
            click: function () {
                S.close()
            }
        }
    ]

</script>